package com.zlsy.learning.leetcode.recursion.r509;

/**
 * @author zhouliang
 * @date 2020/8/18 15:03
 */
public class Fib {

    /**
     * 递归
     * @param N
     * @return
     */
  public int fib(int N) {
    if (N <= 1) {
      return N;
    }
    // if N = 2 fib(1)+fib(0);
    // if N = 3 fib(2)+fib(1);
    // if N = ... fib(...)+fib(...);
    return fib(N - 1) + fib(N - 2);
  }
}
